Skip to content

block snippet backpack - #11611

Open
Joey Wunderlich (jwunderl) wants to merge 25 commits into
dev/jwunderl/bubbles-and-whiteboardfrom
dev/jwunderl/backpack
Open

Joey Wunderlich (jwunderl) wants to merge 25 commits into
dev/jwunderl/bubbles-and-whiteboardfrom
dev/jwunderl/backpack

Conversation

@jwunderl

@jwunderl Joey Wunderlich (jwunderl) commented Sep 16, 2026

Copy link
Copy Markdown
Member

i reallly, really need to figure out how to make this stop adding so many tests for every little tweak i make....

https://arcade.makecode.com/app/cb07a15575a7e967d3a7c4335496cc5df3db4ad6-98c5cdd261

right click on any block that can hold others, or drag to the backpack icon.

seing about implementing another route on backend for storing these individually rather than syncing all as part of account settings like it's currently written to (as that has 64kb cap). implemented but that means new tests on this require staging, so check backend pr for test link.

does some other clean up as part of pr; that bug where the experiments / etc banner messes up css throughout editor is fixed, and copy / paste blocks should have the same checking for extensions / prompt to add if missing

@jwunderl
Joey Wunderlich (jwunderl) added this pull request to stack #11612 September 16, 2026 01:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The asset editor can trap users after save failures, and animated previews ignore reduced-motion preferences.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds a portable block-snippet Backpack to Project Tools, including dependency-aware insertion, asset editing, previews, search, persistence, and accessibility integration.

Changes:

  • Adds Backpack capture, validation, storage, search, preview, and project-import workflows.
  • Integrates isolated native asset editors and Blockly drag/drop.
  • Adds styling, documentation, typings, and extensive tests.
File Description
webapp/​src/​container.tsx Passes tutorial and sign-in handling to Project Tools.
webapp/​src/​components/​ProjectTools.tsx Adds the Backpack tab and interaction state.
webapp/​src/​components/​pianoRoll/​AssetNameModal.tsx Uses the contextual asset project.
webapp/​src/​components/​musicEditor/​EditControls.tsx Validates names against the contextual project.
webapp/​src/​components/​ImageFieldEditor.tsx Supports isolated asset projects and stores.
webapp/​src/​components/​ImageEditor/​tilemap/​TilePalette.tsx Creates tiles in the contextual project.
webapp/​src/​components/​ImageEditor/​store/​imageReducer.ts Resolves assets through an optional project.
webapp/​src/​components/​ImageEditor/​ImageEditor.tsx Isolates asset and nested tile editor state.
webapp/​src/​components/​ImageEditor/​ImageCanvas.tsx Creates copied tiles in the contextual project.
webapp/​src/​components/​ImageEditor/​BottomBar.tsx Uses contextual name validation.
webapp/​src/​components/​BackpackPreview.tsx Lazily renders code and asset previews.
webapp/​src/​components/​BackpackAssetEditDialog.tsx Hosts isolated native asset editing.
webapp/​src/​components/​AssetEditorContext.ts Defines the optional asset-project context.
webapp/​src/​blockSnippet.ts Validates snippets and resolves dependencies.
webapp/​src/​blocks.tsx Integrates Backpack capture, import, drag, and clipboard flows.
webapp/​src/​backpackStorage.ts Exposes Backpack storage adapters.
webapp/​src/​backpackSearch.ts Implements local fuzzy search.
webapp/​src/​backpackProject.ts Prepares and inserts Backpack snippets.
webapp/​src/​backpackPreview.ts Generates bounded block thumbnails.
webapp/​src/​backpackAssetPreview.ts Generates isolated native asset previews.
webapp/​src/​backpackAssetEditor.ts Implements scratch-project asset editing.
webapp/​src/​assets.ts Adds explicit project parameters to asset helpers.
webapp/​src/​assetEditor.tsx Cleans up iframe messaging and returns success.
webapp/​src/​app.tsx Registers Backpack asset-editing integration.
theme/​sidedoc.less Includes Backpack styles.
theme/​project-tools.less Supports a third responsive tool tab.
theme/​project-backpack.less Styles Backpack UI and modal states.
tests/​pxt-editor-test/​editorrunner.ts Consolidates Project Tools tests.
tests/​project-tools-test/​whiteboard.spec.js Updates whiteboard integration coverage.
tests/​project-tools-test/​whiteboard.fixture.js Adds Backpack fixture integration.
tests/​project-tools-test/​theme-helpers.js Removes obsolete theme helpers.
tests/​project-tools-test/​storage.spec.js Consolidates persistence tests.
tests/​project-tools-test/​README.md Updates test instructions and ownership.
tests/​project-tools-test/​keyboard.spec.js Consolidates shortcut-routing coverage.
tests/​project-tools-test/​browser.spec.js Consolidates browser launch checks.
tests/​project-tools-test/​backpack-search.spec.js Tests Backpack search behavior.
tests/​project-tools-test/​backpack-preview.spec.js Tests block preview generation.
tests/​project-tools-test/​backpack-editor.spec.js Tests editor capture and import integration.
tests/​project-tools-test/​backpack-asset-popup.spec.js Tests native asset popup behavior.
tests/​project-tools-test/​backpack-asset-edit.spec.js Tests isolated asset editing and previews.
pxtservices/​iframeDriver.ts Restricts pre-handshake iframe messages.
pxtlib/​auth.ts Defines Backpack data contracts.
pxtblocks/​index.ts Exports Backpack Blockly APIs.
pxtblocks/​fields/​field_utils.ts Makes serialized tilemaps portable.
pxtblocks/​blockDragger.ts Adds Backpack drag-target handling.
localtypings/​pxteditor.d.ts Extends asset-editor response typings.
localtypings/​pxtarget.d.ts Adds the Backpack target flag.
docs/​project-tools.md Documents Backpack usage and behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread webapp/src/components/BackpackAssetEditDialog.tsx Outdated
Comment thread webapp/src/components/BackpackPreview.tsx
Comment thread pxtlib/auth.ts Outdated
Comment thread pxtlib/auth.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Target changes can misfile captures, and failed persistence after insertion can produce duplicate snippets on retry.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)
Resolved since last review (2)

Comment thread webapp/src/blocks.tsx
Comment on lines +2614 to +2618
const headerId = this.parent.state.header.id;
const signedIn = auth.loggedIn();
const userId = auth.userProfile()?.id;
const isCurrentAccount = (): boolean => auth.loggedIn() === signedIn
&& (!signedIn || auth.userProfile()?.id === userId);
Comment thread webapp/src/backpackProject.ts Outdated
Comment on lines +56 to +58
pxtblockly.pasteBackpackBlock(saved.code, workspace, coordinates, saved.kind); // Owns the single undo group and asset remapping.
await wait(() => Blockly.renderManagement.finishQueuedRenders());
await wait(host.saveAsync);
Comment on lines +20 to +23
or failure-stage matrices. Use [browser.js](browser.js), await actual effects and
transactions, and unmount before closing pages. Network/account boundaries are
mocked; check cross-device sync, keyboard/touch and screen readers manually.
before release. See [feature usage](../../docs/project-tools.md).
Comment thread pxtblocks/backpack.ts
}

/** Parse untrusted storage before calling any Blockly loaders or field/mutation hooks. */
export function parseBackpackCode(code: string): BackpackCode {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels a bit overcomplicating it, though reading it does seem to cover good cases. commenting to revisit / see how can narrow it down to be more like, feeling like something we'd actually write

@jwunderl

Copy link
Copy Markdown
Member Author

okay, tons of tests but if you just... ignore those... seems like reasonable spot to me so far. target branch is #11609 (that's also where bulk of the lines removed are from since i did the test clean up all at once in here), but that's mainly just if you want extra context on the project tools portion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants